use serde::{Serialize, Deserialize};
use crate::Resources;

#[derive(Serialize, Deserialize, Debug)]
pub struct UVRegion {
    pub name: String,
    pub diagonal: (f32, f32, f32, f32)
}

impl UVRegion {
    pub fn new(name: &str, diagonal: (f32, f32, f32, f32)) -> Self {
        Self {
            name: name.to_owned(),
            diagonal
        }
    }
}

#[derive(Serialize, Deserialize, Debug)]
#[serde(tag = "type")]
pub enum Resource {
    Image { regions: Option<Vec<UVRegion>>},
    Text,
    Bin,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct ResourceDescriptor {
    pub path: String,
    pub resource: Resource,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct Manifest {
    pub resources: Vec<String>,
    pub sub_directories: Option<Vec<String>>,
}